
#pragma once

using namespace System::Collections::Generic;
using namespace NUnit::Framework;

#include <ttg/services.h>
#include "CommonNodes.h"

#ifdef TTG_PL_VISUALIZER

namespace RuntimeLowTests
{
	namespace pipeline
	{
		[TestFixture]
		public ref class LogTests
		{
			public:
				[Test]
				void LoggerPlayer()
				{
					try
					{
						ServiceBase::getRef()->start();
						//Starting pipeline and logger.
						{
							Pipeline<int, int> pl(wrap(new IncNode()) + wrap(new IncNode()) * wrap(new IncNode()));
							PipelineLogger logger("LoggerPlayer.test");
							pl.run(0);
							pl.run(1);
							pl.run(2);
							pl.run(4);
						}
						//Starting player.
						{
							PipelinePlayer player("LoggerPlayer.test");
						}
						ServiceBase::getRef()->stop();
					}
					catch (Error &err)
					{ Assert::Fail(gcnew System::String(err.toString())); }
					if (!System::IO::File::Exists("LoggerPlayer.test"))
						Assert::Fail("Log was not created");
					else
						System::IO::File::Delete("LoggerPlayer.test");
				}
		};
	}
}

#endif
